<template>
  <view :style="{height : pageHeight + 'px'}" class="contnet">
    <view class="DetailList">
      <view class="tiele">
        {{ noticeData.messageAssemble.headline }}
      </view>
      <view class="sendTime">
        时间：{{ noticeData.messageAssemble.createTime }}
      </view>
      <view class="contentList">
        <view class="textContent">
          {{ noticeData.messageAssemble.content }}
          <!-- <tui-textarea placeholder="请输入内容" :value="detailContent" height=""></tui-textarea> -->

        </view>
      </view>

      <image :src="noticeData.messageAssemble.assemblePlaceUrl" class="newsImg">
    </view>
  </view>
</template>

<script>
import {
  readMessage,
  queryAssemblePersonList
} from '@/api/tourplan.js'

export default {
  data() {
    return {
      pageHeight: 750,
      noticeData: [],
    }
  },
  onLoad: function (options) {
    const that = this
    uni.getSystemInfo({
      success: function (res) {
        that.pageHeight = res.windowHeight
      }
    });
    that.initData(options)
  },
  methods: {
    //初始化数据
    initData(options) {
      const that = this
      console.log(options)
      const dataJSON = decodeURIComponent(options.dataNotice)
      that.noticeData = JSON.parse(dataJSON)
      if (that.noticeData.messageAssemble.type === 0) {
        that.noticeData.headline = '行程通知',
            that.noticeData.content =
                `${that.noticeData.name},您有一个旅行计划，将于${that.noticeData.messageAssemble.departTime}启程，请您提前准备好行李和心情，在${that.noticeData.messageAssemble.assemblePlaceName}集合，开启愉快的旅程`
      }
      // that.getDetai()
      that.userReadMes(that.noticeData.id)
    },

    //根据id获取消息详情
    getDetai() {
      queryAssemblePersonList({
        id: this.noticeData.id,
      }).then(res => {
        console.log(res)
      })
    },

    //已读
    userReadMes(id) {
      const that = this
      readMessage({
        messageAssembleId: id,
        type: 2
      }).then(res => {

      })
    }
  }
}
</script>

<style>
@import url('noticeDetail.css');
</style>
